Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Metal type layout reflection for nested parameter blocks. #6042

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

csyonghe
Copy link
Collaborator

@csyonghe csyonghe commented Jan 9, 2025

When computing layout for Metal target for the following type using MetalArgumentBuffer layout:

struct Params
{
     ParameterBlock<Data> data;
     Texture2D t;
}

Params::t should receive id=1, but due to a bug around parameter group type layout, if struct field ha ParameterBlock type and if the ParameterBlock consumes any actual non space layout units, they are not accounted for during construction of a struct layout. This PR fixes this issue so we can correct report t at id = 1.

@csyonghe csyonghe added the pr: non-breaking PRs without breaking changes label Jan 9, 2025
@csyonghe csyonghe requested a review from a team as a code owner January 9, 2025 05:19
@@ -2351,7 +2362,9 @@ static SimpleLayoutInfo _getParameterGroupLayoutInfo(
//
// TODO: wouldn't it be any different to just allocate this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this TODO still relevant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested this yet. I believe there are reasons why things are done this way but I didn't have time to trace to the bottom of this.

@csyonghe csyonghe merged commit 5484533 into shader-slang:master Jan 10, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants